public class SwapNumbers {
    public static void main(String[] args){
        int x = 7, y = 12;
        System.out.println("before swapping: x= "+x+" ,y= "+y);

        // XOR swap algorithm
        x = x ^ y;
        y = x ^ y;
        x = x ^ y;

        System.out.println("after swapping: x= "+x+" ,y= "+y);
    }   
}